"""
MinIO对象存储配置
"""

import os
from pydantic_settings import BaseSettings
from pydantic import Field


class MinIOConfig(BaseSettings):
    """MinIO对象存储配置"""
    
    # MinIO服务器配置
    endpoint: str = Field(
        default=os.getenv("MINIO_ENDPOINT", "115.190.11.152:9000"),
        description="MinIO服务器地址（不含http://）"
    )
    
    access_key: str = Field(
        default=os.getenv("MINIO_ACCESS_KEY", "j00MvwsnLsZyuEogxPRb"),
        description="MinIO访问密钥"
    )
    
    secret_key: str = Field(
        default=os.getenv("MINIO_SECRET_KEY", "TzMr41qepvJZGpmOVdZtFX3WeY6yKlG2U6g3wrmY"),
        description="MinIO密钥"
    )
    
    secure: bool = Field(
        default=os.getenv("MINIO_SECURE", "false").lower() == "true",
        description="是否使用HTTPS"
    )
    
    # Bucket配置
    bucket_name: str = Field(
        default=os.getenv("MINIO_BUCKET", "pdf-highlights"),
        description="存储桶名称"
    )
    
    # 文件配置
    file_prefix: str = Field(
        default=os.getenv("MINIO_FILE_PREFIX", "highlights"),
        description="文件路径前缀"
    )
    
    # URL配置
    public_url: str = Field(
        default=os.getenv("MINIO_PUBLIC_URL", "http://115.190.11.152:9000"),
        description="MinIO公网访问地址"
    )
    
    # 连接配置
    connect_timeout: int = Field(
        default=int(os.getenv("MINIO_CONNECT_TIMEOUT", "30")),
        description="连接超时时间（秒）"
    )
    
    read_timeout: int = Field(
        default=int(os.getenv("MINIO_READ_TIMEOUT", "60")),
        description="读取超时时间（秒）"
    )
    
    class Config:
        env_file = ".env"
        env_file_encoding = "utf-8"


# 导出配置实例
minio_config = MinIOConfig()



